package com.recommended.util;

import org.apache.mahout.cf.taste.recommender.IDRescorer;

import java.util.Set;

/**
 * 根据专业进行过滤
 * @author Administrator
 */
public class ProfessionalRescorer implements IDRescorer {
    final private Set<Long> dataIds;

    public ProfessionalRescorer(Set<Long> dataIds) {
        this.dataIds = dataIds;
    }


    @Override
    public double rescore(long id, double originalScore) {
        return isFiltered(id) ? Double.NaN : originalScore;
    }

    @Override
    public boolean isFiltered(long id) {
        return dataIds.contains(id);
    }
}
